<?php

function rpc( $json_request ) {
    global $PARAPARA;

    $req_param = $json_request->param;

    if(!$req_param) {
        return new RPC_Error($json_request->operation, "PARAM", "No params");
    };

    $dbl = $PARAPARA->dblayer;

    $event   = $dbl->get_newest_event();
    $newest_event_id = $event->id;
    
    $rpc_retval = array( 
        'newest_event_id' => $newest_event_id, 
        'config'          => $PARAPARA->config
        );
    return new RPC_Response( $json_request->operation, $rpc_retval );

}

return rpc( $json_request );

?>
